#include<stdio.h>
#include<stdlib.h>
typedef int elemtype;
typedef struct dnode
{
	elemtype data;
	struct dnode *next,*pre;
}dnode,*dlinklist;

void initlist(dlinklist *l)
{
	*l=(dnode*)malloc(sizeof(dnode));
	(*l)->next=*l;
	(*l)->pre=*l;
	return ;
}

void dlisttailinsert(dlinklist l,int n)
{
	elemtype x;
	dnode *s, *r = l;
    for (int i = 0; i < n; i++) 
	{
        if (scanf("%d", &x) != 1) 
		{
            break;
        }
        s = (dnode *)malloc(sizeof(dnode));
        s->data = x;
        s->next = r->next;
        s->pre = r;
        r->next->pre = s;
        r->next = s;
        r = s;
    }
    r->next = l;
    l->pre = r;
}
void reverse(dlinklist l,int a,int b)
{
	dnode *p=l->next;
	int count=1;
	while(p!=l&&count<a)
	{
		p=p->next;
		count++;
	}
	if(p==l)
	{
		return ;
	}
	dnode *q=p;
	while(p!=l&&count<b)
	{
		q=q->next;
		count++;
	}
	if(q==l)
	{
		return ;
	}
	p=q;
	int f=1;
	while(p!=l&&count>=a)
	{
		if(!f)
		{
			printf(" ");
		}
		printf("%d",p->data);
		f=0;
		p=p->pre;
		count--;
	}
	printf("\n");
}

void freelist(dlinklist l) {
    dnode *p = l->next;
    while (p != l) {
        dnode *temp = p;
        p = p->next;
        free(temp);
    }
    free(l);
}

int main()
{
	int n;
	while(scanf("%d",&n)==1&&n!=0)
	{
		int x,y;
		scanf("%d %d",&x,&y);
		dlinklist l;
		initlist(&l);
		dlisttailinsert(l,n);
		reverse(l,x,y);
		freelist(l);
	}
	return 0;
}
 

